home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 400_01 / socketpp-1.5 / test / tpopentest.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-06  |  984 b   |  40 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2.  
  3. // tpopentest.cc. Test for -*- C++ -*- socket library
  4. // Copyright (C) 1992,1993 Gnanasekaran Swaminathan <gs4t@virginia.edu>
  5. // 
  6. // Permission is granted to use at your own risk and distribute this software
  7. // in source and binary forms provided the above copyright
  8. // notice and this paragraph are preserved on all copies.
  9. // This software is provided "as is" with no express or implied warranty.
  10. //
  11. // Version: 07Nov93 1.5
  12.  
  13. #include <iostream.h>
  14. #include <stdlib.h>
  15. #include <ctype.h>
  16.  
  17. int main(int ac, char** av)
  18. {
  19.     if (ac != 2) {
  20.     cerr << "USAGE: " << av[0] << " -iob\n";
  21.     return 1;
  22.     }
  23.     char buf[256];
  24.     
  25.     switch (av[1][1]) {
  26.     case 'i':
  27.     cin.getline (buf, 255);
  28.     cout << av[0] << ' ' << av[1] << ": " << buf << endl;
  29.     break;
  30.     case 'o':
  31.     cout << av[0] << ' ' << av[1] << ": Hello O world!!!" << endl;
  32.     break;
  33.     case 'b':
  34.     cin.getline(buf, 255);
  35.     cout << buf << endl;
  36.     system (buf);
  37.     break;
  38.     }
  39. }
  40.